package day_2022_7_to_8.day48;

/**
 * @author haomin
 * @date 2022/08/30 15:00
 **/
public class Day45_7_Offer14_CuttingRope {
    class Solution {
        public int cuttingRope(int n) {
            if(n < 4) return n == 1 ? 1 : n-1;
            int sum = 1;
            while(n > 4){
                sum *= 3;
                n -= 3;
            }
            return sum * n;
        }
    }
}